package xyz.syyrjx.blog.util.ai;

import org.slf4j.Logger;

import javax.servlet.http.HttpServletRequest;

/**
 * @author 大地崩坏苍蝇兽
 * @date 2024/2/21 20:43
 * @description ...
 * @since v0.0.1
 */
public class AiLogUtil {

    public static void logDialogues(Logger logger
            , String model
            , String prompt
            , String content
            , HttpServletRequest request){

        String realIp = request.getHeader("X-Real-IP");
        if (realIp == null || realIp.trim().length() == 0) {
            realIp = request.getHeader("X-Forwarded-For");
        }
        logger.info("ip地址为 {} 的用户问{}:{}", realIp, model, prompt);

        logger.info("{}回答:{}", model, content);
    }

}
